// prototype
const Car = {
    type: 'car',
    name: '',
    drive: () => console.log('driving...')
}
// realization 1
const myCar = Object.create(Car, {
    name: {
        value: 'tank',
        writable: true
    }
});
console.log(myCar.type);
console.log(myCar.name);
myCar.name = 'bus';
console.log(myCar.name);
myCar.drive();
// realization 2
const createCar = (function () {
    function F(name) {
        this.name = name;
    }
    return function (proto, ...args) {
        F.prototype = proto;
        return new F(...args);
    };
})();
const newCar = createCar(Car, 'taxi');
console.log(newCar.type);
console.log(newCar.name);
newCar.drive();
